package com.duan.laugh.event.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.duan.laugh.common.core.util.Query;
import com.duan.laugh.common.core.util.R;
import com.duan.laugh.event.pojo.entity.PreJob;
import com.duan.laugh.event.service.IPreJobService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <p>
 * 预入职 controller
 * </p>
 *
 * @author liutf
 * @since 2019-11-08
 */
@Api(tags = "预入职")
@RestController
@RequestMapping("/pre-job")
public class PreJobController {
    @Autowired
    private IPreJobService preJobService;

    /**
     * 新增预入职
     *
     * @param preJob 实体
     * @return true/false
     */
    @PostMapping
    @ApiOperation("新增预入职")
    public R save(@RequestBody PreJob preJob) {
        return R.ok(preJobService.save(preJob));
    }

    /**
     * 根据id查看预入职
     *
     * @param id
     * @return PreJob
     */
    @GetMapping("/{id}")
    @ApiOperation("根据id查看预入职")
    public R<PreJob> getById(@PathVariable String id) {
        return R.ok(preJobService.getById(id));
    }

    /**
     * 分页查询预入职
     *
     * @param params 分页对象
     * @return 分页对象
     */
    @GetMapping("/page")
    @ApiOperation("分页查询预入职")
    public IPage<PreJob> page(@RequestParam Map<String, Object> params) {
        return preJobService.page(new Query<>(params));
    }

    /**
     * 根据id删除预入职
     *
     * @param id
     * @return true/false
     */
    @DeleteMapping("/{id}")
    @ApiOperation("根据id删除预入职")
    public R removeById(@PathVariable String id) {
        return R.ok(preJobService.removeById(id));
    }

    /**
     * 根据id修改预入职
     *
     * @param preJob 实体
     * @return true/false
     */
    @PutMapping
    @ApiOperation("根据id修改预入职")
    public R updateById(@RequestBody PreJob preJob) {
        return R.ok(preJobService.updateById(preJob));
    }

    @PostMapping("/contract")
    @ApiOperation("保存合同")
    public R saveContract(@RequestBody Map<String, Object> params) {
        return R.ok();
    }

    @PostMapping("/provide")
    @ApiOperation("公牌发放")
    public R saveProvide(@RequestBody Map<String, Object> params) {
        return R.ok();
    }

    @PostMapping("/social")
    @ApiOperation("社保增员")
    public R saveSocial(@RequestBody Map<String, Object> params) {
        return R.ok();
    }

    @PostMapping("/person")
    @ApiOperation("保存个人信息")
    public R savePerson(@RequestBody Map<String, Object> params) {
        return R.ok();
    }

}

